package jwr.basic;

import java.util.Scanner;

public class Ch04_Ex5 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a,b;
		String op;
		System.out.print("두 정수와연산자를 입력하시오>>");
		a = sc.nextInt();
		b = sc.nextInt();
		op = sc.next();
		if(op.equals("+")){
			Add cal = new Add();
			cal.setValue(a, b);
			System.out.println(cal.toString());
		}else if(op.equals("-")){
			Sub cal = new Sub();
			cal.setValue(a, b);
			System.out.println(cal.toString());
		}else if(op.equals("*")){
			Mul cal = new Mul();
			cal.setValue(a, b);
			System.out.println(cal.toString());
		}else if(op.equals("/")){
			Div cal = new Div();
			cal.setValue(a, b);
			System.out.println(cal.toString());
		}else{
			System.out.println("연산자를 제대로 입력해주세요.");
		}
	}

}

class Add{
	private int a,b;
	public Add() {
		
	}
	public void setValue(int a,int b){
		this.a = a;
		this.b = b;
	}
	public int calculate(){
		return a+b;
	}
	@Override
	public String toString() {
		String result="";
		result = a+" + "+b+" = "+calculate();
		return result;
	}
}

class Sub{
	private int a,b;
	public Sub(){
		
	}
	void setValue(int a,int b){
		this.a = a;
		this.b = b;
	}
	int calculate(){
		return a-b;
	}
	@Override
	public String toString() {
		String result="";
		result = a+" - "+b+" = "+calculate();
		return result;
	}
}

class Mul{
	private int a,b;
	public Mul() {
	}
	void setValue(int a,int b){
		this.a = a;
		this.b = b;
	}
	int calculate(){
		return a*b;
	}
	@Override
	public String toString() {
		String result="";
		result = a+" * "+b+" = "+calculate();
		return result;
	}
}

class Div{
	private int a,b;
	public Div() {
	}
	void setValue(int a,int b){
		this.a = a;
		this.b = b;
	}
	int calculate(){
		return a/b;
	}
	@Override
	public String toString() {
		String result="";
		result = a+" / "+b+" = "+calculate();
		return result;
	}
}
